from typing import List
inf = 0x7f7f7f7f
def changeWithSmallestCoins(coin_values:List[int], change:int)->int:
    dp = [inf for _ in range(change + 1)] # dp[i] 表示 找i钱的个数
    dp[0] = 0
    for i in range(1,change + 1):
        for c in coin_values:
            if c > i or dp[i-c] >= inf: continue
            dp[i] = min(dp[i-c]+1,dp[i])
    return dp[change] if dp[change] < inf else -1

if __name__ == "__main__":
    coins = list(map(int,input().split(sep=" ")))
    change = int(input())
    print(changeWithSmallestCoins(coins,change))